import { createRouter, createWebHashHistory } from 'vue-router'

// 路由配置
const routes = [
    {
        path:'/',
        redirect:'/login' //重定向
    },
    {
        path:'/login',
        name:'login',
        component:()=>import('../views/login/index.vue')
    },
    {
        path:'/home',  //首页布局
        name:'home',
        meta:{title:'首页'},
        component:()=>import('../views/home/index.vue'),
        children:[
            {
                path:'/index',  //首页模块
                name:'index',
                meta:{title:'首页'},
                component:()=>import('../views/home/index/index.vue')
            },
            {
                path:'/monitor',  //电量监控模块
                name:'monitor',
                meta:{title:'电量监控'},
                component:()=>import('../views/home/monitor/index.vue'),
                children:[
                    {
                        path:'/monitor/info',  //电量监控模块-车辆详情
                        name:'info',
                        meta:{title:'车辆详情'},
                        component:()=>import('../views/home/monitor/info/index.vue')
                    },
                    {
                        path:'/monitor/list',  //电量监控模块-列表
                        name:'list',
                        meta:{title:'车辆列表'},
                        component:()=>import('../views/home/monitor/list/index.vue')
                    },
                ]
            },
            {
                path:'/vehicle',  //车辆监控模块
                name:'vehicle',
                meta:{title:'车辆监控'},
                component:()=>import('../views/home/vehicle/index.vue')
            },
            {
                path:'/census',  //统计分析模块
                name:'census',
                meta:{title:'统计分析'},
                component:()=>import('../views/home/census/index.vue')
            },
        ]
    }
]
const router = createRouter({
    history:createWebHashHistory(),
    routes
})
export default router